<template>
   <div>
    <van-nav-bar title="面经登录" />
    <van-form @submit="onSubmit">
      <van-field
        :rules="[{ required: true, message: '请填写用户名' }]"
        label="用户名"
        label-width="50"
        name="username"
        placeholder="用户名"
        v-model="username"
      />
      <van-field
        :rules="[{ required: true, message: '请填写密码' }]"
        label="密码"
        label-width="50"
        name="password"
        placeholder="密码"
        type="password"
        v-model="password"
      />
      <div style="margin: 16px;">
        <van-button block native-type="submit">登录</van-button>
      </div>
      <div style="text-align: right;padding-right:20px;">
        <router-link style="color:#0970a5" to="/register">注册账号</router-link>
      </div>
    </van-form>
  </div>
</template>
<script>
import request from '@/utils/request.js'
export default{
    name:'',
    data () {
        return {
            username:'Lyt200325',
            password:'1010102'
        }
    },
    created () {
    },
    computed:{
    },
    methods:{
      onsubmit(values) {
        console.log('submit',values)
        request.post('/user/login',values)
      }
    }
}
</script>
<style lang='less'  scoped>
    .van-button {
  background-color: #fa6d1d;
  color: #fff;
}
</style>
